﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

using _XNA__RunningDeath.GLO;


namespace _XNA__RunningDeath.GUI
{
    class CGUI_Help:CDiaLogBox
    {
        Texture2D _texBackground;
        Texture2D _texBtnBack;
        public CGUI_Help(ContentManager content,GameTime gameTime,SpriteBatch spriteBatch):base
            (content,gameTime,spriteBatch)
        {
            if (this._content != null)
            {
                this._texBackground = this._content.Load<Texture2D>(@"GUI/bgHelp");
                this._texBtnBack = this._content.Load<Texture2D>(@"GUI/btnBack");
                this._texBG = this._content.Load<Texture2D>(@"GUI/guiBG");
                this._dstoado = this._content.Load<Dictionary<string, Rectangle>>(@"GUI/ztoadoXMLgui");
            }
        }
        public override void Update(GameTime gameTime)
        {
            CGLOBAL.MousePrev = CGLOBAL.MouseCurrent;
            CGLOBAL.MouseCurrent = Mouse.GetState();
            if(CGLOBAL.MouseCurrent.LeftButton==ButtonState.Pressed && CGLOBAL.MousePrev.LeftButton== ButtonState.Released)
            {
                if(this._dstoado["btnBackHelp"].Contains(new Point(CGLOBAL.MouseCurrent.X,CGLOBAL.MouseCurrent.Y)))
                {
                    CGLOBAL.soundFXbtn.Play(CThamSo.volumSound, CThamSo.pitchSound, CThamSo.panSound);
                    CGLOBAL.NextGUI = true;
                    CGLOBAL.GUISelected = GUIenum.guiMainMenu;
                }
            }
        }
        public override void Draw(GameTime gameTime)
        {
            this._spriteBatch.Begin();
            this._spriteBatch.Draw(this._texBG,Vector2.Zero,Color.Gray);
            this._spriteBatch.Draw(this._texBackground, new Vector2(this._dstoado["bgHelp"].X, this._dstoado["bgHelp"].Y),Color.White);
            this._spriteBatch.Draw(this._texBtnBack,new Vector2(this._dstoado["btnBackHelp"].X,this._dstoado["btnBackHelp"].Y),Color.White);
            this._spriteBatch.End();
        }
    }
}
